package de.dhbw.karlsruhe.picsim.util.impl;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: goesen
 * Date: Apr 14, 2010
 * Time: 12:50:14 AM
 */
final class BitsImpl extends BitSetSupport {
    private final List<Boolean> ourBits;

    BitsImpl(final List<Boolean> list) {
        if (list.contains(null)) {
            throw new IllegalArgumentException();
        }
        ourBits = new ArrayList<Boolean>(list);
    }


    @Override
    public int getLength() {
        return ourBits.size();
    }

    @Override
    public boolean isSet(final int bitNr) {
        return ourBits.get(bitNr);
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("de.dhbw.karlsruhe.picsim.util.impl.BitSetPicImpl");
        sb.append("{ourBits=").append(ourBits);
        sb.append(", length=").append(getLength());
        sb.append('}');
        return sb.toString();
    }
}
